﻿using System;

namespace Graphe.Collations.Commands
{
    public class RemoveManuscriptCommand : Command
    {
        #region Constructor

        public RemoveManuscriptCommand(Manuscript manuscript, ManuscriptCollection collection)
        {
            _manuscript = manuscript;
            _collection = collection;
        }

        #endregion
        #region Private Instance Fields

        private Manuscript _manuscript;
        private ManuscriptCollection _collection;
        private int _indexOfItem;

        #endregion

        public override void Execute()
        {
            _indexOfItem = _collection.IndexOf(_manuscript);
            _collection.Remove(_manuscript);
        }

        public override void Undo()
        {
            _collection.Insert(_indexOfItem, _manuscript);
        }
    }
}
